'use strict';

module.exports = function countSameElements(collection) 
{
  let collectionC=[];
  for (let i=0;i<collection.length;)
  {  
    let count=0;
    for (let j=i;j<collection.length;j++)
      {
        if(collection[i]==collection[j])
          {
            count+=1;
          }
      }
    collectionC.push({"key":collection[i],"count":count});
    i+=count;
  }
  return collectionC;
}
